| Conditions | 2 |
| Total Lines | 190 |
| Code Lines | 143 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component } from "react" |
||
| 161 | renderPlayerStatsFull = (player) => { |
||
| 162 | if (this.state.loading === false && this.state.data) { |
||
| 163 | const { |
||
| 164 | playerStatistics = [], |
||
| 165 | } = this.state.data |
||
| 166 | |||
| 167 | return ( |
||
| 168 | <article className={"player-detail__stats card"}> |
||
| 169 | <header className={"card__header"}> |
||
| 170 | <h4>Statistieken</h4> |
||
| 171 | </header> |
||
| 172 | <div className={"card__content"}> |
||
| 173 | <table className={"player-detail__stats__table"}> |
||
| 174 | <thead> |
||
| 175 | <tr> |
||
| 176 | <th |
||
| 177 | className={ |
||
| 178 | "player-detail__column player-detail__column--string" |
||
| 179 | } |
||
| 180 | > |
||
| 181 | Team |
||
| 182 | </th> |
||
| 183 | <th |
||
| 184 | className={ |
||
| 185 | "player-detail__column player-detail__column--number" |
||
| 186 | } |
||
| 187 | > |
||
| 188 | <span title="Wedstrijden gespeeld">P</span> |
||
| 189 | </th> |
||
| 190 | <th |
||
| 191 | className={ |
||
| 192 | "player-detail__column player-detail__column--number" |
||
| 193 | } |
||
| 194 | > |
||
| 195 | <span title="Wedstrijden gewonnen">W</span> |
||
| 196 | </th> |
||
| 197 | <th |
||
| 198 | className={ |
||
| 199 | "player-detail__column player-detail__column--number" |
||
| 200 | } |
||
| 201 | > |
||
| 202 | <span title="Wedstrijden gelijkgespeeld">D</span> |
||
| 203 | </th> |
||
| 204 | <th |
||
| 205 | className={ |
||
| 206 | "player-detail__column player-detail__column--number" |
||
| 207 | } |
||
| 208 | > |
||
| 209 | <span title="Wedstrijden verloren">L</span> |
||
| 210 | </th> |
||
| 211 | <th |
||
| 212 | className={ |
||
| 213 | "player-detail__column player-detail__column--number" |
||
| 214 | } |
||
| 215 | > |
||
| 216 | <img |
||
| 217 | src={iconCardYellow} |
||
| 218 | title="Gele kaart" |
||
| 219 | alt="Gele kaart" |
||
| 220 | className="player-detail__stats--header_icon" |
||
| 221 | /> |
||
| 222 | </th> |
||
| 223 | <th |
||
| 224 | className={ |
||
| 225 | "player-detail__column player-detail__column--number" |
||
| 226 | } |
||
| 227 | > |
||
| 228 | <img |
||
| 229 | src={iconCardRed} |
||
| 230 | title="Rode kaart" |
||
| 231 | alt="Rode kaart" |
||
| 232 | className="player-detail__stats--header_icon" |
||
| 233 | /> |
||
| 234 | </th> |
||
| 235 | <th |
||
| 236 | className={ |
||
| 237 | "player-detail__column player-detail__column--number" |
||
| 238 | } |
||
| 239 | > |
||
| 240 | <img |
||
| 241 | src={iconGoal} |
||
| 242 | title="Doelpunt(en) gescoord" |
||
| 243 | alt="Doelpunt(en) gescoord" |
||
| 244 | className="player-detail__stats--header_icon" |
||
| 245 | /> |
||
| 246 | </th> |
||
| 247 | <th |
||
| 248 | className={ |
||
| 249 | "player-detail__column player-detail__column--number" |
||
| 250 | } |
||
| 251 | > |
||
| 252 | <img |
||
| 253 | src={iconCleansheet} |
||
| 254 | title="Cleansheets" |
||
| 255 | alt="Cleansheets" |
||
| 256 | className="player-detail__stats--header_icon" |
||
| 257 | /> |
||
| 258 | </th> |
||
| 259 | <th |
||
| 260 | className={ |
||
| 261 | "player-detail__column player-detail__column--number" |
||
| 262 | } |
||
| 263 | > |
||
| 264 | <span title="Minuten gespeeld"> |
||
| 265 | <Icon icon="fa-clock-o" /> |
||
| 266 | </span> |
||
| 267 | </th> |
||
| 268 | </tr> |
||
| 269 | </thead> |
||
| 270 | <tbody> |
||
| 271 | {playerStatistics.map(function (stats) { |
||
| 272 | return ( |
||
| 273 | <tr> |
||
| 274 | <td |
||
| 275 | className={ |
||
| 276 | "player-detail__column player-detail__column--string" |
||
| 277 | } |
||
| 278 | > |
||
| 279 | {stats.team.replace("Voetbal : ", "")} |
||
| 280 | </td> |
||
| 281 | <td |
||
| 282 | className={ |
||
| 283 | "player-detail__column player-detail__column--number" |
||
| 284 | } |
||
| 285 | > |
||
| 286 | {stats.gamesPlayed} |
||
| 287 | </td> |
||
| 288 | <td |
||
| 289 | className={ |
||
| 290 | "player-detail__column player-detail__column--number" |
||
| 291 | } |
||
| 292 | > |
||
| 293 | {stats.gamesWon} |
||
| 294 | </td> |
||
| 295 | <td |
||
| 296 | className={ |
||
| 297 | "player-detail__column player-detail__column--number" |
||
| 298 | } |
||
| 299 | > |
||
| 300 | {stats.gamesEqual} |
||
| 301 | </td> |
||
| 302 | <td |
||
| 303 | className={ |
||
| 304 | "player-detail__column player-detail__column--number" |
||
| 305 | } |
||
| 306 | > |
||
| 307 | {stats.gamesLost} |
||
| 308 | </td> |
||
| 309 | <td |
||
| 310 | className={ |
||
| 311 | "player-detail__column player-detail__column--number" |
||
| 312 | } |
||
| 313 | > |
||
| 314 | {stats.yellowCards} |
||
| 315 | </td> |
||
| 316 | <td |
||
| 317 | className={ |
||
| 318 | "player-detail__column player-detail__column--number" |
||
| 319 | } |
||
| 320 | > |
||
| 321 | {stats.redCards} |
||
| 322 | </td> |
||
| 323 | <td |
||
| 324 | className={ |
||
| 325 | "player-detail__column player-detail__column--number" |
||
| 326 | } |
||
| 327 | > |
||
| 328 | {stats.goals} |
||
| 329 | </td> |
||
| 330 | <td |
||
| 331 | className={ |
||
| 332 | "player-detail__column player-detail__column--number" |
||
| 333 | } |
||
| 334 | > |
||
| 335 | {stats.cleanSheets} |
||
| 336 | </td> |
||
| 337 | <td |
||
| 338 | className={ |
||
| 339 | "player-detail__column player-detail__column--number" |
||
| 340 | } |
||
| 341 | > |
||
| 342 | {stats.minutes}' |
||
| 343 | </td> |
||
| 344 | </tr> |
||
| 345 | ) |
||
| 346 | })} |
||
| 347 | </tbody> |
||
| 348 | </table> |
||
| 349 | </div> |
||
| 350 | </article> |
||
| 351 | ) |
||
| 563 |